package com.authine.cloudpivot.ext.dto.transfer;

import com.authine.mvp.app.launcher.domain.SelectorFormat;
import com.authine.mvp.app.permission.dto.clientobject.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName TransferOrderDto
 * @Description: 转采订单表
 * @Author cjj
 * @Date 2021/6/18
 * @Version V1.0
 **/
@Data
@Schema(description = "TransferOrderDto")
@ApiModel("转采订单表")
public class TransferOrderDto extends BaseDto {
    @Schema(description = "转采订单商品ID")
    private String id;
    @Schema(description = "转采订单商品ID集合")
    private List<String> ids;
    @Schema(description = "状态")
//    private OrderGoodsStatusEnum transferOrderGoodsStatus;
    private String transfer_order_status;
    @Schema(description = "会员ID")
    private SelectorFormat member_id;
    @Schema(description = "云平台订单ID")
    private String cloud_order_id;
    @Schema(description = "云平台订单商品ID")
    private String cloud_order_goods_id;
    @Schema(description = "税率")
    private String tax_rate;
    @Schema(description = "含税商品合计")
    private BigDecimal total;
    @Schema(description = "未税商品合计")
    private String pre_total;
    @Schema(description = "含税商品运费共计")
    private String amount;
    @Schema(description = "未税商品运费共计")
    private String pre_amount;
    @Schema(description = "收货人")
    private String receiver;
    @Schema(description = "电话")
    private String phone;
    @Schema(description = "邮编")
    private String postal;
    @Schema(description = "详细地址")
    private String address;
    @Schema(description = "备注")
    private String memo;
    @Schema(description = "删除")
    private String del;
    @Schema(description = "操作人")
    private String operator;
    @Schema(description = "订单类型")
//    private TransferOrderTypeEnum orderType;
    private String order_type;
    @Schema(description = "订单po号")
    private String erp_po;
    @Schema(description = "组织名称")
    private String organization_name;
    @Schema(description = "用户名称")
    private String user_name;
    @Schema(description = "组织ID")
    private SelectorFormat organization_id;
    @Schema(description = "账期")
    private Integer account_period;
    @Schema(description = "平台id")
    private String platform_id;
    @Schema(description = "平台名称")
    private String platform_name;
    @Schema(description = "pageIndex")
    private Integer pageIndex;
    @Schema(description = "pageSize")
    private Integer pageSize;
    @Schema(description = "转采订单商品", hidden = true)
    private List<TransferOrderGoodsDto> transferOrderGoods;

    public static Map<String, Object> voToEntity(TransferOrderDto dto) {
        Map<String, Object> result = new HashMap<>();
        result.put("member_id", dto.getMember_id());
        result.put("user_name", dto.getUser_name());
        result.put("cloud_order_id", dto.getCloud_order_id());
        result.put("tax_rate", dto.getTax_rate());
        result.put("pre_total", dto.getPre_total());
        result.put("amount", dto.getAmount());
        result.put("receiver", dto.getReceiver());
        result.put("phone", dto.getPhone());
        result.put("postal", dto.getPostal());
        result.put("address", dto.getAddress());
        result.put("transfer_order_status", dto.getTransfer_order_status());
        result.put("memo", dto.getMemo());
        result.put("order_type", dto.getOrder_type());
        result.put("erp_po", dto.getErp_po());
        result.put("organization_id", dto.getOrganization_id());
        result.put("organization_name", dto.getOrganization_name());
        result.put("account_period", dto.getAccount_period());
        result.put("platform_id", dto.getPlatform_id());
        result.put("platform_name", dto.getPlatform_name());
        return result;
    }
}
